package com.demo.highSpeedMap.controller;

import com.demo.highSpeedMap.entity.CityCarsInfo;
import com.demo.highSpeedMap.service.CitysCarsInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@RequestMapping("/CityCars")
@Controller
public class CitysCarsInfoController {
    @Autowired
    CitysCarsInfoService citysCarsInfoService;
    @ResponseBody
    @RequestMapping("/getAll")
    public List<CityCarsInfo> getAll()
    {
        return citysCarsInfoService.getAllInfo();
    }
    @RequestMapping("/getOne")
    public String getOne(@RequestParam("city") String  city, Model m)
    {
        System.out.println(city);
        m.addAttribute("city",city);
        return "carNumsInOneCity";
    }
}